## Class Structures_Graph_Node

Description

The Structures_Graph_Node class represents a Node that can be member of a graph node set.

A graph node can contain data. Under this API, the node contains default data, and key index data. It behaves, thus, both as a regular data node, and as a dictionary (or associative array) node.

Regular data is accessed via getData and setData. Key indexed data is accessed via getMetadata and setMetadata.

- copyright: (c) 2004 by Sérgio Carvalho
- author: Sérgio Carvalho <mailto:sergio.carvalho@portugalmail.com>

Located in /Structures/Graph/Node.php (line 57)

Method Summary
Structures_Graph_Node Structures_Graph_Node ()
boolean connectsTo (mixed &$target)
void connectTo (Structures_Graph &$destinationNode)
mixed &getData ()
Structures_Graph &getGraph ()
mixed &getMetadata (string $key, [boolean $nullIfNonexistent = false])
array getNeighbours ()
integer inDegree ()
boolean metadataKeyExists (string $key)
integer outDegree ()
mixed setData (mixed $data)
void setGraph (Structures_Graph &$graph)
void setMetadata (string $key, mixed $data)
void unsetMetadata (string $key)
Methods
Constructor Structures_Graph_Node (line 78)

Constructor

- access: public

Structures_Graph_Node Structures_Graph_Node ()
connectsTo (line 275)

Test wether this node has an arc to the target node

- return: True if the two nodes are connected
- access: public

boolean connectsTo (mixed &$target)
connectTo (line 236)

Connect this node to another one.

If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.

- access: public

void connectTo (Structures_Graph &$destinationNode)

- Structures_Graph &$destinationNode: Node to connect to

getData (line 119)

Node data getter.

Each graph node can contain a reference to one variable. This is the getter for that reference.

- return: Data stored in node
- access: public

mixed &getData ()
getGraph (line 90)

Node graph getter

- return: Graph where node is stored
- access: public

Structures_Graph &getGraph ()
getMetadata (line 171)

Node metadata getter

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method gets the data under the given key. If the key does not exist, an error will be thrown, so testing using metadataKeyExists might be needed.

- return: Metadata Data stored in node under given key
- access: public
- see: Structures_Graph_Node::metadataKeyExists()

mixed &getMetadata (string $key, [boolean $nullIfNonexistent = false])

- string $key: Key
- boolean $nullIfNonexistent: nullIfNonexistent (defaults to false).

getNeighbours (line 262)

Return nodes connected to this one.

- return: Array of nodes
- access: public

array getNeighbours ()
inDegree (line 309)

Calculate the in degree of the node.

The indegree for a node is the number of arcs entering the node. For non directed graphs, the indegree is equal to the outdegree.

- return: In degree of the node
- access: public

integer inDegree ()
metadataKeyExists (line 151)

Test for existence of metadata under a given key.

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method tests whether a given metadata key exists for this node.

- access: public

boolean metadataKeyExists (string $key)

- string $key: Key to test

outDegree (line 333)

Calculate the out degree of the node.

The outdegree for a node is the number of arcs exiting the node. For non directed graphs, the outdegree is always equal to the indegree.

- return: Out degree of the node
- access: public

integer outDegree ()
setData (line 134)

Node data setter

Each graph node can contain a reference to one variable. This is the setter for that reference.

- return: Data to store in node
- access: public

mixed setData (mixed $data)
setGraph (line 104)

Node graph setter. This method should not be called directly. Use Graph::addNode instead.

- access: public
- see: Structures_Graph::addNode()

void setGraph (Structures_Graph &$graph)

- Structures_Graph &$graph: Set the graph for this node.

setMetadata (line 214)

Node metadata setter

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method stores data under the given key. If the key already exists, previously stored data is discarded.

- access: public

void setMetadata (string $key, mixed $data)

- string $key: Key
- mixed $data: Data

unsetMetadata (line 196)

Delete metadata by key

Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an associative array or in a dictionary. This method removes any data that might be stored under the provided key. If the key does not exist, no error is thrown, so it is safe using this method without testing for key existence.

- access: public

void unsetMetadata (string $key)

- string $key: Key

Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by phpDocumentor 1.2.3